# Copyright (c) 2006,2007,2008 Michael Borgmann <mail@lechuck.de>
# This code is released under the ISC License

env = Environment()

# Help ------------------------------------------

print "Try 'scons -h' for more information"

Help("""
Usage: scons [OPTIONS] [TARGET] [CONFIG]

[OPTIONS] and [TARGET] are covered in command line options, use scons -H

[CONFIG]: KEY=VALUE [...]

CROSS
	Select cross compilation target
	ex: CROSS=win32 - Linux > Windows (i586-mingw32msvc-g++)

BUILD
	Use debug/release to select build settings
	ex: BUILD="release" - default is debug
""")

# System Detection ------------------------------

print "Host System ... " + env['PLATFORM']

# Default Settings ------------------------------

env['CXX'] = 'g++'
env['CXXFLAGS'] = ['-g3', '-Wall']

# Libraries -------------------------------------

env['LIBS'] = 'SDL'

# Command Line Settings -------------------------

#  Cross Compile
if ARGUMENTS.get('CROSS') == 'win32':
	env['CXX'] = 'i586-mingw32msvc-g++'
	env['PROGSUFFIX'] = '.exe'
	env['LIBS'] = ['mingw32', 'SDLmain', env['LIBS']]

# Build Version
if ARGUMENTS.get('BUILD') == 'release':
	env['CXXFLAGS'] = '-O2'

# Build -----------------------------------------

env.Program('hello', 'hello.cpp')
